﻿var status = -1;

function action(mode, type, selection) {
    if (mode == 1) {
        status++;
    } else {
        if (status == 0) {
            cm.dispose();
        }
        status--;
    }
    if (status == 0) {
        if ((cm.getSpace(1) > 1||cm.getSpace(2) > 1||cm.getSpace(3) > 1||cm.getSpace(4) > 1)&&cm.getHyPay(3) >= 500 && cm.getPlayer().getCSPoints(1) >= 50000) {
            cm.sendYesNo("这里是充值抽奖专区。我背包里面包含了巨匠 布莱克 无爱 白色 金标骑士 中级贝勒德 坚韧意志绿色等所有装备哦.如果你充值满了500可以再这里花费5W点卷抽奖一次哦！你确定要抽奖吗？注：获得高级装备几率提高10倍。");
        } else {
            cm.sendOk("我背包里面包含了巨匠 布莱克 无爱 白色 金标骑士 中级贝勒德 坚韧意志绿色等装备哦。如果你累计金额满了100可以再这里花费5万点卷抽奖一次哦！你的充值金额到500或足够5万点卷了吗？");
            cm.safeDispose();
        }
    } else if (status == 1) {
            var item;
            var chance = Math.floor(Math.random() * 165);
			if(chance >= 0 && chance <= 50){
                var itemList = new Array(
1152121,
1132212,
1132244,
1122265,
1032221,
1113073,
1132233,
1152139,
1003841,
1102553,
1082522,
1052608,
1052609,
1072815,
1222044,
1232041,
1242044,
1302248,
1312135,
1322181,
1332205,
1342075,
1362074,
1362079,
1372161,
1382192,
1402172,
1412122,
1422124,
1432150,
1442202,
1452189,
1462177,
1472197,
1482151,
1492162,
1522078,
1532081,
1252031,
1542060,
1552060,
1022232,
1032200,
1152141,
1152143,
1152145,
1152147,
1152149,
1152151,
1152154,
1113055,
1113063,
1113067,
1113178,
1212077,
1222072,
1232071,
1402204,
1242076,
1302285,
1312162,
1322213,
1332235,
1342084,
1362099,
1372186,
1382220,
1412144,
1422149,
1432176,
1442232,
1452214,
1462202,
1472223,
1482177,
1492188,
1522103,
1532106,
1252058,
1542075,
1552075,
1212072,
1222067,
1232064,
1242069,
1242070,
1302070,
1312142,
1322100,
1332214,
1342079,
1362081,
1372168,
1382199,
1402185,
1412126,
1422129,
1432158,
1442209,
1452196,
1462184,
1472205,
1482159,
1492170,
1522085,
1532089,
1252062
                    );
                item = cm.gainGachaponItem(itemList[Math.floor(Math.random() * itemList.length)], 1, "累计金额大转盘(500)");
            } else if (chance >= 51 && chance <= 100) {
                var itemList = new Array(
1152121,
1132212,
1132244,
1122265,
1032221,
1113073,
1132233,
1152139,
1003841,
1102553,
1082522,
1052608,
1052609,
1072815,
1222044,
1232041,
1242044,
1302248,
1312135,
1322181,
1332205,
1342075,
1362074,
1362079,
1372161,
1382192,
1402172,
1412122,
1422124,
1432150,
1442202,
1452189,
1462177,
1472197,
1482151,
1492162,
1522078,
1532081,
1252031,
1542060,
1552060,
1022232,
1032200,
1152141,
1152143,
1152145,
1152147,
1152149,
1152151,
1152154,
1113055,
1113063,
1113067,
1113178,
1212077,
1222072,
1232071,
1402204,
1242076,
1302285,
1312162,
1322213,
1332235,
1342084,
1362099,
1372186,
1382220,
1412144,
1422149,
1432176,
1442232,
1452214,
1462202,
1472223,
1482177,
1492188,
1522103,
1532106,
1252058,
1542075,
1552075,
1212072,
1222067,
1232064,
1242069,
1242070,
1302070,
1312142,
1322100,
1332214,
1342079,
1362081,
1372168,
1382199,
1402185,
1412126,
1422129,
1432158,
1442209,
1452196,
1462184,
1472205,
1482159,
1492170,
1522085,
1532089,
1252062
				                    );
                item = cm.gainGachaponItem(itemList[Math.floor(Math.random() * itemList.length)], 1, "累计金额大转盘(500)");
            } else if (chance >= 101 && chance <= 130) {
                var itemList = new Array(
1152121,
1132212,
1132244,
1122265,
1032221,
1113073,
1132233,
1152139,
1003841,
1102553,
1082522,
1052608,
1052609,
1072815,
1222044,
1232041,
1242044,
1302248,
1312135,
1322181,
1332205,
1342075,
1362074,
1362079,
1372161,
1382192,
1402172,
1412122,
1422124,
1432150,
1442202,
1452189,
1462177,
1472197,
1482151,
1492162,
1522078,
1532081,
1252031,
1542060,
1552060,
1022232,
1032200,
1152141,
1152143,
1152145,
1152147,
1152149,
1152151,
1152154,
1113055,
1113063,
1113067,
1113178,
1212077,
1222072,
1232071,
1402204,
1242076,
1302285,
1312162,
1322213,
1332235,
1342084,
1362099,
1372186,
1382220,
1412144,
1422149,
1432176,
1442232,
1452214,
1462202,
1472223,
1482177,
1492188,
1522103,
1532106,
1252058,
1542075,
1552075,
1212072,
1222067,
1232064,
1242069,
1242070,
1302070,
1312142,
1322100,
1332214,
1342079,
1362081,
1372168,
1382199,
1402185,
1412126,
1422129,
1432158,
1442209,
1452196,
1462184,
1472205,
1482159,
1492170,
1522085,
1532089,
1252062
				                    );
                item = cm.gainGachaponItem(itemList[Math.floor(Math.random() * itemList.length)], 1, "累计金额大转盘(500)");
            } else if (chance >= 131 && chance <= 150) {
                var itemList = new Array(
1152121,
1132212,
1132244,
1122265,
1032221,
1113073,
1132233,
1152139,
1003841,
1102553,
1082522,
1052608,
1052609,
1072815,
1222044,
1232041,
1242044,
1302248,
1312135,
1322181,
1332205,
1342075,
1362074,
1362079,
1372161,
1382192,
1402172,
1412122,
1422124,
1432150,
1442202,
1452189,
1462177,
1472197,
1482151,
1492162,
1522078,
1532081,
1252031,
1542060,
1552060,
1022232,
1032200,
1152141,
1152143,
1152145,
1152147,
1152149,
1152151,
1152154,
1113055,
1113063,
1113067,
1113178,
1212077,
1222072,
1232071,
1402204,
1242076,
1302285,
1312162,
1322213,
1332235,
1342084,
1362099,
1372186,
1382220,
1412144,
1422149,
1432176,
1442232,
1452214,
1462202,
1472223,
1482177,
1492188,
1522103,
1532106,
1252058,
1542075,
1552075,
1212072,
1222067,
1232064,
1242069,
1242070,
1302070,
1312142,
1322100,
1332214,
1342079,
1362081,
1372168,
1382199,
1402185,
1412126,
1422129,
1432158,
1442209,
1452196,
1462184,
1472205,
1482159,
1492170,
1522085,
1532089,
1252062
				                    );
                item = cm.gainGachaponItem(itemList[Math.floor(Math.random() * itemList.length)], 1, "累计金额大转盘(500)");
            } else if (chance >= 151 && chance <= 160) {
                var itemList = new Array(2040303, //耳环智力必成卷
1152121,
1132212,
1132244,
1122265,
1032221,
1113073,
1132233,
1152139,
1003841,
1102553,
1082522,
1052608,
1052609,
1072815,
1222044,
1232041,
1242044,
1302248,
1312135,
1322181,
1332205,
1342075,
1362074,
1362079,
1372161,
1382192,
1402172,
1412122,
1422124,
1432150,
1442202,
1452189,
1462177,
1472197,
1482151,
1492162,
1522078,
1532081,
1252031,
1542060,
1552060,
1022232,
1032200,
1152141,
1152143,
1152145,
1152147,
1152149,
1152151,
1152154,
1113055,
1113063,
1113067,
1113178,
1212077,
1222072,
1232071,
1402204,
1242076,
1302285,
1312162,
1322213,
1332235,
1342084,
1362099,
1372186,
1382220,
1412144,
1422149,
1432176,
1442232,
1452214,
1462202,
1472223,
1482177,
1492188,
1522103,
1532106,
1252058,
1542075,
1552075,
1212072,
1222067,
1232064,
1242069,
1242070,
1302070,
1312142,
1322100,
1332214,
1342079,
1362081,
1372168,
1382199,
1402185,
1412126,
1422129,
1432158,
1442209,
1452196,
1462184,
1472205,
1482159,
1492170,
1522085,
1532089,
1252062
                    );
                item = cm.gainGachaponItem(itemList[Math.floor(Math.random() * itemList.length)], 1, "累计金额大转盘(500)");
            } else {
 		var itemList = new Array(
1152121,
1132212,
1132244,
1122265,
1032221,
1113073,
1132233,
1152139,
1003841,
1102553,
1082522,
1052608,
1052609,
1072815,
1222044,
1232041,
1242044,
1302248,
1312135,
1322181,
1332205,
1342075,
1362074,
1362079,
1372161,
1382192,
1402172,
1412122,
1422124,
1432150,
1442202,
1452189,
1462177,
1472197,
1482151,
1492162,
1522078,
1532081,
1252031,
1542060,
1552060,
1022232,
1032200,
1152141,
1152143,
1152145,
1152147,
1152149,
1152151,
1152154,
1113055,
1113063,
1113067,
1113178,
1212077,
1222072,
1232071,
1402204,
1242076,
1302285,
1312162,
1322213,
1332235,
1342084,
1362099,
1372186,
1382220,
1412144,
1422149,
1432176,
1442232,
1452214,
1462202,
1472223,
1482177,
1492188,
1522103,
1532106,
1252058,
1542075,
1552075,
1212072,
1222067,
1232064,
1242069,
1242070,
1302070,
1312142,
1322100,
1332214,
1342079,
1362081,
1372168,
1382199,
1402185,
1412126,
1422129,
1432158,
1442209,
1452196,
1462184,
1472205,
1482159,
1492170,
1522085,
1532089,
1252062
		    );
                item = cm.gainGachaponItem(itemList[Math.floor(Math.random() * itemList.length)], 1, "累计金额大转盘(500)");
	    }
            if (item != -1) {
		cm.gainNX( -50000);
                cm.sendOk("你获得了 #b#t" + item + "##k.");
		cm.dispose();
            } else {
                cm.sendOk("你确实累计金额到500了吗或足够5万点卷?如果是,请你确认在背包的装备,消耗,其他窗口中是否有一格以上的空间?");
		cm.dispose();
            }
        } else {
            cm.sendOk("出现错误 或 您取消");
		cm.dispose();
}
}
